package online.exam.controller;

import online.exam.common.GlobalConstant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author 王景煜
 * created in 2019/11/16 11:12
 */

@Controller
@RequestMapping(value = "/student-action")
public class StuActionController {

    @GetMapping(value = "/index")
    public String stu() {
        return "student/index";
    }

    @GetMapping(value = "/test-detail")
    public String stuPaper() {
        return "student/detail";
    }

    @GetMapping(value = "/do-test")
    public String stuPaperDetail() {
        return "student/paper";
    }

    @GetMapping("/logout")
    public String logout(HttpServletRequest request) {
        HttpSession session = request.getSession();
        session.removeAttribute(GlobalConstant.STUDENT);
        return "redirect:/index";
    }

    @GetMapping("/setting")
    public String setting() {
        return "student/setting";
    }
}
